package com.spirng.leetcode.day07;

public class Test700 {
    TreeNode treeNode=new TreeNode();
    public TreeNode searchBST(TreeNode root, int val) {
       if(root==null){
           return null;
       }
       if(root.val>val){
           return searchBST(root.left,val);
       }
        if(root.val<val){
            return searchBST(root.right,val);
        }
       if(root.val== val){
           return treeNode=root;
       }
       return treeNode;
    }
}
